home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / tclmotif.1 / tclmotif / tm.1.2 / examples / tmp < prev    next >
Encoding:
Text File  |  1994-03-07  |  2.9 KB  |  123 lines

  1. #!/usr/local/bin/moat
  2.  
  3.  
  4.  
  5.     $w.dsh.list manageChild
  6.     $w.dsh.list singleSelectionCallback "foundInterp %item $w"
  7. }
  8.  
  9. proc foundInterp {item w} {
  10.     global interp
  11.  
  12.     set interp $item
  13.     [$w.dsh parent] destroyWidget
  14.     .main.form.label setValues \
  15.     -labelString $interp
  16.  
  17.     findTree .
  18. }
  19.  
  20. proc findTree {w} {
  21.     global interp
  22.  
  23.     set children [send $interp "$w getValues -children c; set c"]
  24.     if {$children != ""} {
  25.     foreach i [split $children ", "] {
  26.         if {$i != {}} {
  27.         .main.form.tree addItem $i 0
  28.         }
  29.         if {$i != {} && [send $interp "$i isComposite"] == "true"} {
  30.             findTree $i
  31.         }
  32.     }
  33.     }
  34. }
  35.  
  36. proc findResources {w} {
  37.     global interp
  38.  
  39.     .main.form.resources setValues \
  40.     -items "" -itemCount 0
  41.     set resources [send $interp "$w resources"]
  42. #    puts stdout $resources
  43.     set resources [lsort $resources]
  44.  
  45.     # unmap so we don't get flickering on reset
  46.     .main.form.resources unmapWidget
  47.     foreach i $resources {
  48.     set item "[lindex $i 1]: [lindex $i 4]"
  49.     .main.form.resources addItem $item 0
  50.     }
  51.     .main.form.resources mapWidget
  52. }
  53.  
  54. xtAppInitialize
  55.  
  56. xmMainWindow .main managed
  57. xmForm .main.form managed
  58.  
  59. xmLabel .main.form.label managed \
  60.     -labelString "" \
  61.     -topAttachment attach_form \
  62.     -leftAttachment attach_form \
  63.     -rightAttachment attach_form
  64. xmScrolledList .main.form.tree managed \
  65.     -selectionPolicy single_select \
  66.     -topAttachment attach_widget \
  67.     -topWidget .main.form.label \
  68.     -leftAttachment attach_form \
  69.     -rightAttachment attach_position \
  70.     -rightPosition 50 \
  71.     -bottomAttachment attach_form
  72. xmScrolledList .main.form.resources managed \
  73.     -topAttachment attach_widget \
  74.     -topWidget .main.form.label \
  75.     -leftAttachment attach_position \
  76.     -leftPosition 50 \
  77.     -rightAttachment attach_form  \
  78.     -bottomAttachment attach_form
  79.  
  80. # I am not supporting simple menu functions, so do this the long way
  81.  
  82. # top menu bar
  83. xmMenuBar .main.menuBar managed
  84. xmCascadeButton .main.menuBar.file managed \
  85.     -labelString File \
  86.     -mnemonic F
  87. xmCascadeButton .main.menuBar.help managed \
  88.      -labelString Help \
  89.     -mnemonic H
  90.  
  91. # file pulldown
  92. xmPulldownMenu .main.menuBar.fileMenu
  93. xmPushButton .main.menuBar.fileMenu.Open managed \
  94.     -mnemonic O
  95. xmPushButton .main.menuBar.fileMenu.Quit managed \
  96.     -mnemonic Q
  97. .main.menuBar.file setValues -subMenuId .main.menuBar.fileMenu
  98.  
  99. # callbacks for file menu
  100. .main.menuBar.fileMenu.Quit activateCallback "exit 0"
  101. .main.menuBar.fileMenu.Open  activateCallback "findInterp %w"
  102.  
  103.  
  104. # help pulldown
  105. xmPulldownMenu .main.menuBar.helpMenu managed
  106. xmPushButton .main.menuBar.helpMenu.help managed \
  107.     -labelString Help \
  108.     -mnemonic H
  109. .main.menuBar.help setValues -subMenuId .main.menuBar.helpMenu
  110.  
  111. .main.menuBar setValues -menuHelpWidget .main.menuBar.help
  112.  
  113. .main setValues -workWindow .main.form \
  114.         -menuBar .main.menuBar
  115.  
  116. .main.form.tree singleSelectionCallback {findResources %item}
  117.  
  118.  
  119. . realizeWidget
  120. . mainLoop
  121.  
  122.  
  123.